﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Serialization;

namespace JsonServer.Interfaces
{
    [XmlRoot("JsonServersConfig")]
    public class JsonServersConfig
    {
        [XmlArray("WebFolders")]
        [XmlArrayItem("WebFolder")]
        public WebFolderConfig[] WebFolderConfig;

        public string WebFolder;
        public string JsFolder;
        public string CssFolder;
        public string ImageFolder;

        [XmlArray("JsonServers")]
        [XmlArrayItem("JsonServer")]
        public JsonServerConfig[] JsonServerConfig;
    }

    public class WebFolderConfig
    {
        public enum FolderLocationType
        {
            Absolute,
            RelativeToWebFolder,
            RelativeToJsFolder,
            RelativeToCssFolder,
            RelativeToImageFolder,
        } ;

        [XmlAttribute("regex")]
        public string Regex;

        public string Folder;
        public FolderLocationType Type;
    }


    public class JsonServerConfig
    {
        [XmlAttribute("name")]
        public string Name;

        public string Assembly;
        public string Type;

        public XmlNode Config;
    }
}
